From 931b198dae23863dd2e5c205bd819991a7259d85 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Wed, 11 Nov 2020 10:05:41 -0800
Subject: [PATCH] cmake: Fix compatiblity with older cmake versions.

IMPORTED_TARGET was only introduced in cmake 3.6 and FAudio
does not build with GStremer versions older than 1.9.2.

Fixes https://github.com/FNA-XNA/FAudio/issues/226

v2: Use _LDFLAGS to ensure linking against the correct gstreamer.
---
 CMakeLists.txt | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb57a672..58da7f18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,9 +142,9 @@ if(GSTREAMER)
 
 	# Find GStreamer
 	find_package(PkgConfig)
-	pkg_check_modules(GST REQUIRED IMPORTED_TARGET gstreamer-1.0)
-	pkg_check_modules(GSTAUDIO REQUIRED IMPORTED_TARGET gstreamer-audio-1.0)
-	pkg_check_modules(GSTAPP REQUIRED IMPORTED_TARGET gstreamer-app-1.0)
+	pkg_check_modules(GST REQUIRED gstreamer-1.0>=1.9.2)
+	pkg_check_modules(GSTAUDIO REQUIRED gstreamer-audio-1.0>=1.9.2)
+	pkg_check_modules(GSTAPP REQUIRED gstreamer-app-1.0>=1.9.2)
 
 	# Include/Link GStreamer...
 	target_include_directories(FAudio PRIVATE
@@ -153,9 +153,9 @@ if(GSTREAMER)
 		${GSTAPP_INCLUDE_DIRS}
 	)
 	target_link_libraries(FAudio PRIVATE
-            PkgConfig::GST
-            PkgConfig::GSTAUDIO
-            PkgConfig::GSTAPP
+            ${GST_LDFLAGS}
+            ${GSTAUDIO_LDFLAGS}
+            ${GSTAPP_LDFLAGS}
         )
 endif(GSTREAMER)
 
